package com.websuites.core.service;

import java.util.HashMap;

@SuppressWarnings("unchecked")
public class ServiceBean {
	protected HashMap getPage(Integer pageNumber, Integer pageSize) {
		HashMap mapPage = new HashMap<String, Integer>();
		Integer from = (pageNumber - 1) * pageSize;
		Integer to = pageNumber * pageSize;
		mapPage.put("from", from);
		mapPage.put("to", to);
		return mapPage;
	}

	protected HashMap getPage(HashMap mapParam) {
		Integer pageNumber = (Integer)mapParam.get("pageNumber");
		Integer pageSize = (Integer)mapParam.get("pageSize");
		
		Integer from = (pageNumber - 1) * pageSize;
		Integer to = pageNumber * pageSize;
		mapParam.put("from", from);
		mapParam.put("to", to);

		return mapParam;
	}
}
